export function isArray(arr: any) {
    return arr instanceof Array && Object.prototype.toString.call(arr) === "[object Array]"
}
export function isObject(obj: any) {
    return obj instanceof Object && Object.prototype.toString.call(obj) === "[object Object]"
}
 function initColSpan(tableData:any[], startRowIndex: number, colspanArr: string[]) {
            const spanArr = new Array(tableData.length);
            for (let index = tableData.length - 1; index >= 0; index--) {
                const element: any = tableData[index];
                const keys = Object.keys(element);
                const colArr: { rowspan: number; colspan: number }[] =
                    new Array(keys.length);
                colspanArr = colspanArr || keys;
                for (let z = keys.length - 1; z >= 0; z--) {
                    let spanObj = {} as { rowspan: number; colspan: number };
                    const key = keys[z];
                    const preRow: any = tableData[index + 1];
                    if (
                        startRowIndex <= index &&
                        colspanArr.includes(key) &&
                        preRow &&
                        preRow[key] === element[key]
                    ) {
                        const preRowspan = spanArr[index + 1][z];
                        spanObj.rowspan = preRowspan.rowspan + 1;
                        preRowspan.rowspan = 0;
                    } else {
                        spanObj.rowspan = 1;
                    }
                    const preKey = keys[z + 1];

                    if (
                        startRowIndex <= index &&
                        colspanArr.includes(key) &&
                        preKey &&
                        element[preKey] === element[key]
                    ) {
                        const preColSpanObj = colArr[z + 1];
                        spanObj.colspan = preColSpanObj.colspan + 1;
                        preColSpanObj.colspan = 0;
                    } else {
                        spanObj.colspan = 1;
                    }
                    colArr[z] = spanObj;
                }
                spanArr[index] = colArr;
            }
            return spanArr;
        }